﻿using DevExpress.Internal.WinApi.Windows.UI.Notifications;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 测试项目
{
    public partial class PromptForm : Form
    {
        public PromptForm()
        {
            InitializeComponent();
        }

        int top = 100;

        private void PromptForm_Load(object sender, EventArgs e)
        {
            this.Location = new Point((Screen.PrimaryScreen.Bounds.Width - this.Width) / 2, 20);
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Color color = Color.FromArgb(50, this.ForeColor);
            TextRenderer.DrawText(e.Graphics, "操作成功", this.Font, new Rectangle(0, top, this.Width, this.Height - top), color, Color.Transparent, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            top -= 2;
            this.Invalidate();
            if (top <= 0)
                this.Close();
        }

        protected override bool ShowWithoutActivation => true;
    }
}
